MAPS
Photo by Steven Diaz on Unsplash
Any city, however small, is in fact divided into two.
One the city of the poor, the other of the rich.
These are at war with one another…
— Plato
world_cities <- read.csv("archetypes/capital-cities-population/world-cities.csv", header = TRUE, encoding = "UTF-8")
world_cities <- filter(world_cities, population > 0 )
world_cities
ne_world <- ne_countries(scale = "small", returnclass = "sf")
ne_world <- filter(ne_world, iso_a3 != "ATA")
ne_world <- ne_world %>% st_as_sf() %>% st_set_crs(4326)
world_cities_sf <- world_cities %>% st_as_sf(coords = c("lng", "lat"), crs = 4326)
# theme parameters
theme_opts <- theme(
legend.position = "bottom",
legend.title = element_blank(),
axis.text = element_blank(),
#axis.line = element_blank(),
#axis.ticks = element_blank(),
axis.title = element_blank(),
#panel.grid = element_blank(),
#panel.grid.major = element_blank(),
#panel.grid.minor = element_blank(),
panel.background = element_blank(),
panel.border = element_blank(),
plot.background = element_blank(),
)
v1 = ggplot() +
geom_sf(data = ne_world, color="#AAAAAA", fill="#FFFFFF", size=0.5) +
geom_sf(data = world_cities_sf, aes(size = population, alpha = population), color="#C2185B") +
#scale_x_continuous(name = NULL, breaks = seq(-120, 120, by = 60)) +
#scale_y_continuous(name = NULL, breaks = seq(-60, 60, by = 30)) +
scale_size_continuous(name = "",
range = c(0.5, 10),
breaks = c(1000000, 5000000, 10000000, 30000000),
labels = c("1M", "5M", "10M", "30M")) +
scale_alpha_continuous(range = c(0.1, 0.6), guide = "none") +
coord_sf(crs = "+proj=tissot +lat_1=60 +lat_2=65") +
theme_bw() +
labs(x="", # Longitude
y="", # Latitude
title = "Global City Populations",
subtitle="Tissot Projection") +
theme_opts
girafe(ggobj = v1, width_svg = 16, height_svg = 12,
options = list(opts_sizing(rescale = TRUE, width = 1.0))
)
v2 = ggplot() +
geom_sf(data = ne_world, color="#AAAAAA", fill="#FFFFFF", size=0.5) +
geom_sf(data = world_cities_sf, aes(size = population, alpha = population), color="#C2185B") +
#scale_x_continuous(name = NULL, breaks = seq(-120, 120, by = 60)) +
#scale_y_continuous(name = NULL, breaks = seq(-60, 60, by = 30)) +
scale_size_continuous(name = "",
range = c(0.5, 10),
breaks = c(1000000, 5000000, 10000000, 30000000),
labels = c("1M", "5M", "10M", "30M")) +
scale_alpha_continuous(range = c(0.1, 0.6), guide = "none") +
coord_sf(crs = "+proj=murd1 +lat_1=30 +lat_2=50") +
theme_bw() +
labs(x="", # Longitude
y="", # Latitude
title = "Global City Populations",
subtitle="Murdoch I") +
theme_opts
girafe(ggobj = v2, width_svg = 16, height_svg = 12,
options = list(opts_sizing(rescale = TRUE, width = 1.0))
)